/*
 * CBIO.h
 *
 *  Created on: 2009-5-17
 *      Author: thh
 */

#ifndef CBIO_H_20090518
#define CBIO_H_20090518

#include <openssl/bio.h>

class CBIO {
public:
    class CMETHOD{
    public:
        enum METHOD{F_BASE64,F_BUFFER,F_CIPHER,F_MD,F_NULL,F_SSL,
            S_ACCEPT,S_BIO,S_CONNECT,S_FD,S_FILE,S_MEM } method;
        inline CMETHOD(CMETHOD::METHOD method){ this->method=method; };
        inline bool operator==(const CMETHOD &other){ return this->method==other.method; };
    };
protected:
    BIO *bio;

protected:
    BIO_METHOD *getMethod(CMETHOD method);
    CBIO();
public:
    CBIO(CMETHOD method);
    void ChangeMethod(BIO_METHOD *method);
    operator BIO*() const;
    virtual ~CBIO();
};

#endif /* CBIO_H_20090518 */
